package com.zyj.retry.service;

import com.zyj.retry.dto.Cat;
import org.springframework.retry.annotation.Recover;
import org.springframework.retry.annotation.Retryable;
import org.springframework.stereotype.Service;

@Service
public class CatService {

    @Retryable(maxAttempts = 3)
    public Cat getCat(String name) {
        System.out.println("do");
        throw new RuntimeException();
    }

    @Recover
    public Cat recover() {
        Cat c = new Cat();
        c.name = "臭卷宝";
        return c;
    }

}
